package co.edu.unal.geditor.view;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

import co.edu.unal.geditor.model.ClosedGraphElement;
import co.edu.unal.geditor.model.GraphElement;
import co.edu.unal.geditor.model.RectangleElement;

public class RectangleGraphView extends ElementView
{
	public RectangleGraphView( GraphElement ge )
	{
		super( ge );

		assert ge instanceof RectangleElement;
	}

	@Override
	public void paint( Graphics g )
	{
		Point ul = m_owner.getUpLeft();
		Color color = m_owner.getLinesColor();
		Color fillColor = ((ClosedGraphElement)m_owner).getFillColor();
		Color tmp=g.getColor();
		g.setColor(fillColor);
		g.fillRect( ul.x, ul.y, m_owner.getBoundBox().getWidth(), m_owner.getBoundBox().getHeight() );
		g.setColor(color);
		g.drawRect( ul.x, ul.y, m_owner.getBoundBox().getWidth(), m_owner.getBoundBox().getHeight() );
		g.setColor(tmp);
		super.paint( g );
	}
}
